package com.nju.bean.client.string;

import java.io.*;
import java.net.*;

import org.dom4j.*; 
import org.dom4j.io.*;

public class XmlManager {
    public static Document read(String fileName) throws MalformedURLException, DocumentException {
        SAXReader reader = new SAXReader();
        Document document = reader.read(new File(fileName));
        return document;
     }
	
	public static Document getXML(String text){
		Document doc = null;
		try {
			doc = DocumentHelper.parseText(text);
		} catch (DocumentException e) {
			e.printStackTrace();
		}
		return doc;
	}
	
	public static String getRequest(String text){
		Document doc = getXML(text);
		String request = doc.getRootElement().getName();
		return request;
	}
}
